﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using MND.Commands;
namespace MND.Users
{
    class UserCommandProcessor : Commands.CommandProcessor
    {
        private volatile bool goMP = false;
        private Queue<UserCommand> currentQueue;

        private UserManager masterUM;
        public UserManager MasterUM { get { return masterUM; } }

        public UserCommandProcessor(UserManager master)
        {
            masterUM = master;
        }

        public override void Process()
        {
            // 1. replace queue with a new one
            lock (synchRoot)
            {
                currentQueue = queue;
                queue = new Queue<Commands.UserCommand>();
            }
            Commands.UserCommand uc;
            while (currentQueue.Count > 0)
            {
                uc = currentQueue.Dequeue();

                
            }
        }

        private void Dispatch(Commands.UserCommand uc)
        {

        }
        public void StopProcessing()
        {
            if (goMP)
                goMP = false;
        }

        #region Binding functions
        public User[] GetAllUsers()
        {
            return masterUM.CurrentUsers;
        }
        #endregion
    }
}
